import { Input,Component, OnInit } from '@angular/core';

@Component({
  selector: 'app-chart-trend-prediction',
  templateUrl: './chart-trend-prediction.component.html',
  styleUrls: ['./chart-trend-prediction.component.css']
})
export class ChartTrendPredictionComponent implements OnInit {
  @Input() tagTitle:string;

  public componentName:string="standardPowerUtilizationRate";
  public chartOptions: object;
  ngOnInit() {
    console.log(this.tagTitle);

    this.chartOptions = {
      chart: {
        type: 'line',
        backgroundColor: 'transparent',
      },
      credits: {
        enabled: false
      },
      exporting: {
        enabled: false
      },
      title: {
        text: '',
      },
      xAxis: {
        title: {
          text: '时间（月）'
        },
        categories: [],
        lineWidth:2,
        tickWidth: 0,
        gridLineWidth: 0
      },
      yAxis: {
        title: {
          text: this.tagTitle,
        },
        lineWidth:2,
        plotLines: [{
          value: 0,
          width: 1,
          color: '#808080'
        }]
      },
      tooltip: {
        valueSuffix: '单位'
      },
      plotOptions: {
        series: {
          marker: {
            radius: 3,
          }
        }
      },
      legend: {
        align: 'center',
        verticalAlign: 'bottom',
        x:0,
        y:0,
        borderWidth: 0,
        maxHeight:40,
        margin:20,
        itemWidth:100,
        navigation:{
          activeColor:'#3e82ed',
          arrowSize:13,
          style: {
            fontWeight: 'bold',
            color: '#333',
            fontSize: '13px'
          }
        }
      },
      series: [{
        name: '状态值',
        color: 'rgba(223, 83, 83, .5)',
        data: [52,52.9,53.8,54.6,55.2,56,57,58.2,59.4,61,62,63,64,65,65.8,66.6,67.3,68,68.6,69.2,69.7,70.2,70.6,71,71.3]
      }, {
        name: '标准值',
        color: 'rgba(119, 152, 191, .5)',
        data: [65,65.1,65.2,65.4,65.5,65.6,65.8,65.9,66.0,66.1,66.2,66.4,66.5,66.6,66.7,66.7,66.8,66.9,67,67.1,67.2,67.3,67.4,67.5,67.6]
      }]
    }
  }
}
